<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Page
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: Controller.php 2010-08-31 16:05 idris $
 * @author     Idris
 */

/**
 * @category   Application_Extensions
 * @package    Page
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 */

class Page_Widget_FeaturedController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
    $table = Engine_Api::_()->getDbTable('pages', 'page');

    $prefix = $table->getTablePrefix();

    $settings = Engine_Api::_()->getApi('settings', 'core');
    $ipp = $settings->getSetting('page.featured_count', 6);
    
    $params = array('approved' => 1, 'featured' => 1, 'ipp' => $ipp, 'p' => 1);
    $this->view->pages = $pages = $table->getPaginator($params);
    
    if (!$pages->getTotalItemCount()){
    	return $this->setNoRender();
    }
  }
}